package com.activenetwork.custom.other;

import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.Point;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

import com.activenetwork.util.EnvContext;

@SuppressWarnings("unused")
public class XText implements Text {
	private WebDriver driver;
	private WebElement element;
	
	public XText(WebElement element){
		this.element = element;
		//TODO: what if thread local is empty for get a webdriver
		this.driver = EnvContext.webDriverTL.get();
	}

	@Override
	public void clear() {
		element.clear();
	}

	@Override
	public void click() {
		element.click();
	}

	@Override
	public WebElement findElement(By by) {
		return element.findElement(by);
	}

	@Override
	public List<WebElement> findElements(By by) {
		return element.findElements(by);
	}

	@Override
	public String getAttribute(String attr) {
		return element.getAttribute(attr);
	}

	@Override
	public String getCssValue(String css) {
		return element.getCssValue(css);
	}

	@Override
	public Point getLocation() {
		return element.getLocation();
	}

	@Override
	public Dimension getSize() {
		return element.getSize();
	}

	@Override
	public String getTagName() {
		return element.getTagName();
	}

	@Override
	public String getText() {
		return element.getText();
	}

	@Override
	public boolean isDisplayed() {
		return element.isDisplayed();
	}

	@Override
	public boolean isEnabled() {
		return element.isEnabled();
	}

	@Override
	public boolean isSelected() {
		return element.isSelected();
	}

	@Override
	public void sendKeys(CharSequence... chars) {
		element.sendKeys(chars);
	}

	@Override
	public void submit() {
		element.submit();
	}

	@Override
	public WebElement getEmbedElement() {
		return element;
	}

	@Override
	public void input(String content) {
		element.clear();
		element.sendKeys(content);
	}

}
